package databasetools;

import java.util.Iterator;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.TypedQuery;

/**
 *
 * @author 1790
 */
public class DatabaseReader {

    public void readData() {
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("DatabaseTools");
        EntityManager em = emf.createEntityManager();
        TypedQuery<Weatherhh> query = em.createNamedQuery("Weatherhh.findAll", Weatherhh.class);
        List<Weatherhh> results = query.getResultList();
        System.out.println("results.size()="+results.size());
        

        for (Iterator<Weatherhh> it = results.iterator(); it.hasNext();) {
            Weatherhh weatherhh = it.next();
            System.out.println("weatherhh = " + weatherhh.toString());
        }

    }

}
